<%-- 
    Document   : grupos
    Created on : 03/06/2011, 21:59:49
    Author     : Ricardo
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="br.com.fatecz.database.ConnectionPool"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="<%= request.getContextPath()%>/_recursos/estilos/stylesheet-geral.css" rel="stylesheet" type="text/css" />
        <title>JSP Page</title>
    </head>
    <body>
        <div id="conteudo">
            <div id="tituloPagina"><div class="iconMenuEdicaoNoticias"></div>&nbsp;Lista de Grupos -> <a href="<%=request.getContextPath()%>/grupos.jsp">Novo grupo</a></div>

            <div id="linhaDivisoria"></div>
            <table width="100%" class="table-formulario" cellspacing="3px">
                <thead>
                    <tr>
                        <th>Cód.</th>
                        <th>Nome</th>
                        <th>URL</th>
                        <th>Data/Hora de Criação</th>
                        <th>Área</th>
                        <th>Descrição</th>
                        <th>Perfil Público</th>
                    </tr>
                </thead>
                <tbody>
                <%
                    String SQL = "SELECT * FROM grupos";
                    Connection c = ConnectionPool.getConnection();
                    PreparedStatement stmt = c.prepareStatement(SQL);
                    ResultSet rs = stmt.executeQuery();

                    while (rs.next()) {
                %>
                <tr>
                    <td><% out.println(rs.getString("id"));%></td>
                    <td><% out.println(rs.getString("nome"));%></td>
                    <td><% out.println(rs.getString("url"));%></td>
                    <td><% out.println(rs.getTimestamp("criacao"));%></td>
                    <td><% out.print(rs.getString("area"));%></td>
                    <td><% out.println(rs.getString("descricao"));%></td>
                    <%
                        if (rs.getBoolean("publico") == true) {
                    %>
                    <td><span>Sim</span></td>
                <%                            } else {
                        %>
                    <td><span>Não</span></td>
                                                        
                <%
                               }
                    }
                %>
                </tr>
                </tbody>
            </table>
        </div>
    </body>
</html>
